home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Light ROM 1
/
LIGHT-ROM 1 (Amiga Library Services)(1994).iso
/
ffdisks
/
d883.lha
/
BBBBS
/
BBDoors58.lha
/
rexxDoors
/
ShoList.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1991-12-06
|
5KB
|
193 lines
/* ShoList.rexx - updated for BBBBS.baud - 26 March 1991 */
/* copyright 1989 Richard Lee Stockton and Gramma Software. */
/* This code is freely distributable as long as this copyright */
/* notice remains, unchanged, at the start of the code. Thank you. */
CR='0D'x
SIGNAL ON BREAK_C
SIGNAL ON BREAK_E
/* These are the USAGE strings we output if we see a '?', or a bad letter */
LF = '0A'x
USAGE1 = LF" ARexx USAGE: [ACDFHILMPRSTVWX?]"LF
USAGE2 = ,
" A=directories C=clip list D=devices F=open files H=handlers"LF||CR,
"I=interrupts L=libraries M=memory P=ports R=resources"LF||CR,
"S=semaphores T=ready_tasks V=volumes W=waiting_tasks X=REXX tasks",
LF||CR||LF||CR" no argument exits"||CR
SAY CR
SAY 'This is your chance to see what is going on inside the Amiga that is'CR
SAY 'running BBBBS. You can stick letters together (lp=libraries & ports).'CR
SAY CR
SAY USAGE2
OPTIONS PROMPT 'ShoList: > '
DO FOREVER
PULL x
/* if no argument, then exit */
IF length(x)=0 THEN EXIT;
/* if '?', output USAGE stuff and die */
IF (x=='?') THEN DO
SAY USAGE1||CR
SAY USAGE2||CR
EXIT
END
/* Take each letter in the argument, one at a time */
DO i=1 TO length(x)
y=substr(x,i,1)
/* Select an appropriate title for this letter */
SELECT
WHEN y='A' THEN title = 'Assigned Directories [DOS list]'
WHEN y='C' THEN title = 'Clips [AREXX list]'
WHEN y='D' THEN title = 'Device Drivers'
WHEN y='F' THEN title = 'Open Files [local]'
WHEN y='H' THEN title = 'Handlers [DOS list]'
WHEN y='I' THEN title = 'Interrupts'
WHEN y='L' THEN title = 'Libraries'
WHEN y='M' THEN title = 'MemoryList Items'
WHEN y='P' THEN title = 'Ports'
WHEN y='R' THEN title = 'Resources'
WHEN y='S' THEN title = 'Semaphores'
WHEN y='T' THEN title = 'Ready Tasks'
WHEN y='V' THEN title = 'Volumes [DOS list]'
WHEN y='W' THEN title = 'Waiting Tasks'
WHEN y='X' THEN title = 'REXX Tasks'
OTHERWISE
DO /* Bad Letter in argument. Complain and die */
SAY CR
SAY ' Usage Error!' USAGE1 ' --->' y '?'CR
SAY USAGE2||CR
EXIT
END
END
/* ARexx scans system lists. This is where the good stuff gets done. */
IF y='X' THEN CALL AStatus()
ELSE IF((y='C')|(y='F')) THEN list = show(y,,';')
ELSE list = showlist(y,,';')
/* everything below is just formatting and printing the list to the CLI */
/* based on the longest name in the list, and the number of list items. */
listlength=length(list) /* length in characters of the whole list */
longest=0
j=1
items=0
position=1
DO WHILE(position>0) /* how many total and how long is longest? */
position=pos(';',list,j) /* <-- returns 0 when the list runs out */
IF((position-j)>longest) THEN longest=position-j
IF(position>0) THEN j=position+1
items=items+1
END
IF((listlength+1-j)>longest) THEN longest=listlength+1-j /* last item */
columns = 77%(longest+2) /* we assume an 80 column display */
position=1
count=0
j=1
line = ""
IF(listlength==0) THEN items=0
SAY ' -*-*-*-' items title '-*-*-*-'CR
IF(listlength==0) THEN ITERATE /* no list, go to next letter */
DO WHILE(position>0)
position=pos(';',list,j)
IF(position>0) THEN
DO
nextItem = ""
nextItem = left(substr(list,j,position-j),longest)
IF LENGTH(STRIP(nextItem))==0 THEN
nextItem = left("<blank>",longest)
line = line || nextItem || ' '
j = position + 1
END
ELSE line = line || left(substr(list,j),longest)
count = count + 1
IF(count=columns) THEN
DO
SAY line||CR
count=0
line=""
END
END
IF(count>0) THEN SAY line||CR /* Only print when the line is full */
END
END
EXIT
/* AStatus.rexx ARexx task list display by BaudMan */
AStatus:
RxsBase = findlib("rexxsyslib.library")
Call RxsOffsets()
TaskList = import(offset(RxsBase,RxsBase.rl_TaskList),4)
n=1
list=""
do j=1 TO 999 WHILE( import(TaskList,4) ~= NULL())
name=Import(Import(Offset(TaskList,56),4))
if name='' then do
name='String_'n
n=n+1
end
IF j=1 THEN list=name
ELSE list=list';'name
TaskList = import(TaskList,4)
END
RETURN;
/* Find a given library in the system - copied from Status.rexx */
findlib:
parse arg tofind
execbase = import('00000004'x,4)
nodebase = import(offset(execbase, 378), 4)
do while(import(nodebase,4) ~== NULL())
if import(import(offset(nodebase,10),4)) == tofind then
return nodebase
nodebase = import(nodebase,4)
end
say 'Could not find' tofind||CR
exit(20)
RxsOffsets:
RxsBase.rl_TaskList =168/* List */
RxsBase.rl_NumTask =182 /* WORD */
RxsBase.rl_LibList =184 /* List */
RxsBase.rl_NumLib =198 /* WORD */
RxsBase.rl_ClipList =200 /* List */
RxsBase.rl_NumClip =214 /* WORD */
RxsBase.rl_MsgList =216 /* List */
RxsBase.rl_NumMsg =230 /* WORD */
RETURN;
BREAK_C:
BREAK_E:
EXIT;
/* end of ShoList.rexx for BBBBS | 3 February 1991 */